<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/5
 * Time: 9:50
 */

namespace app\index\model;


use think\Model;

class GiftLog extends Model
{
    protected $userM;
    public function __construct($data = [])
    {
        parent::__construct($data);
        $this->userM = new User();
    }

    public function getUidAttr($value){
        $res = $this->userM->where(['id'=>$value])->field('id,nickname')->find();
        if ($res){
            $res = $res->toArray();
        }
        return $res;
    }

    public function getFromUidAttr($value){
        $res = $this->userM->where(['id'=>$value])->field('id,nickname')->find();
        if ($res){
            $res = $res->toArray();
        }
        return $res;
    }

    public function getGiftIdAttr($value){
        $res = (new Gift())->where(['id'=>$value])->field('id,name')->find();
        if ($res){
            $res = $res->toArray();
        }
        return $res;
    }




}